<?php
$this->breadcrumbs = array(
	'凭证列表' => array(
		'index'
	),
	$model->tokenDate . ' - ' . $model->number => array(
		'view',
		'id' => $model->id
	),
	'更新内容',
);

$this->userActions = array(
	array(
		'label' => '凭证列表',
		'url' => array(
			'index'
		)
	),
	array(
		'label' => '新建凭证',
		'url' => array(
			'create'
		)
	),
	array(
		'label' => '查看凭证',
		'url' => array(
			'view',
			'id' => $model->id
		)
	),
	array(
		'label' => '凭证管理',
		'url' => array(
			'admin'
		)
	),
);
?>

<h1>更新凭证内容 <?php echo $model->tokenDate . ' - ' . $model->number; ?></h1>
<div>备注： <?php
		 echo $model->note;
		 ?></div>
<div>
<?php
$items = $model->items;
?>
<div class="grid-view">
<div class="form">
<?php echo CHtml::beginForm(array(
	'updateItems',
	'id' => $model->id
));
?>
<?php
$items = array_slice($model->items, 0);
$items[] = $newItem;

$this
	->widget('zii.widgets.grid.CGridView',
		array(
			'id' => 'account-token-item-grid',
			'dataProvider' => new CArrayDataProvider($items, array(
				'pagination' => false
			)),
			//'filter' => $model,
			'enablePagination' => false,
			'columns' => array(
				array(
					'header' => '摘要',
					'type' => 'raw',
					'value' => 'CHtml::activeTextField($data, "[$row]summary",array("size"=>"90"));',
					'footer' => '合计'
				),
				array(
					'header' => '科目',
					'type' => 'raw',
					'value' => 'Yii::app()->getController()
	->widget("widgets.accountTokenCategory.JAccountTokenCategorySelector",
		array(
			"model" => $data,
			"attribute" => "[$row]categoryId",
		), true)',
					'footer' => $model->isBalanced() ? "" : "X"
				),
				array(
					'header' => '借方',
					'type' => 'raw',
					'value' => 'CHtml::activeTextField($data, "[$row]debit",array("size"=>"8"));',
					'footer' => Yii::app()->format->formatCurrency($model->totalDebit)
				),
				array(
					'header' => '贷方',
					'type' => 'raw',
					'value' => 'CHtml::activeTextField($data, "[$row]credit",array("size"=>"8"));',
					'footer' => Yii::app()->format->formatCurrency($model->totalCredit)
				),
				/*
				'createTime',
				'createUserId',
				'updateTime',
				'updateUserId',
				 */
				array(
					'class' => 'CButtonColumn',
					'template' => '{delete}',
					'deleteButtonUrl' => 'Yii::app()->controller->createUrl("deleteItem",array("id"=>$data->primaryKey))'
				),
			),
		));
?>
 
<?php echo CHtml::submitButton('添加/保存'); ?>
<?php echo CHtml::endForm(); ?>
</div><!-- form -->
</div>
</div>
